from django.shortcuts import render, HttpResponse
from django.contrib.auth.decorators import login_required
# Create your views here.
def course(request):
    return HttpResponse('This is teacher course')
# @login_required
# def check_info(request):
#     return render(request, 'teacher/check_info.html')

from apps.crm.models import CourseRecord, ScoreRecord
from apps.student.forms import HomeWorkForm
from django.contrib.auth.decorators import login_required

# Create your views here.
@login_required
def check_info(request):

    try:
        st = request.user.related_student
        name = st.detail.real_name
        contents = st.my_class.related_course_record.all()
        print(name)
    except Exception as ex:
        print(ex)
        contents = ""
    # contents = request.user.related_student.my_class.related_course_record.all()
    kwgs = {
        "name": name,
        "course_records": contents
    }
    print(kwgs, "xxx")
    return render(request, 'teacher/check_info.html', kwgs)